# -*- coding: utf-8 -*-
# @File: backend => hand_players.py
# @CreateTime: 2025/8/25 21:37
# @Author: EvanZhang
# @Info: 每一局牌的玩家信息

from tortoise import fields, models

# id | hand_id | user_id | hole_cards | best_rank | win_amount | contributed_pot
class HandPlayer(models.Model):
    id = fields.IntField(pk=True)
    hand = fields.ForeignKeyField('models.Hand', related_name="players", description="所属牌局")
    user = fields.ForeignKeyField("models.User", related_name="hand_players", description="所属用户")
    hole_cards = fields.CharField(max_length=50, description="底牌，逗号分隔")
    best_rank = fields.CharField(max_length=100, null=True, description="最佳牌型")
    win_amount = fields.IntField(default=0, description="赢得的筹码数")
    contributed_pot = fields.IntField(default=0, description="贡献给奖池的筹码数")

    class Meta:
        table = "hand_players"
        description = "每一局牌的玩家信息表"
        unique_together = (("hand", "user"),)
